﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SystemCenterSoa.IRepository.SystemSettings.CommonlyUsedSettings;
using SystemCenterSoa.PoModel.SystemSettings.CommonlyUsedSettings;
using SystemCenterSoa.Repository.CommonLib;

namespace SystemCenterSoa.Repository.SystemSettings.CommonlyUsedSettings
{
    public class QuickLinkListRepository : BaseRepository, IQuickLinkListRepository
    {
        //注入ef的的上下文
        public QuickLinkListRepository(SystemCenterDbSoaContext systemCenterDbSoaContext) : base(systemCenterDbSoaContext)
        {

        }
        public int QuickLinkListAdd(QuickLinkListPo form)
        {
            if(string.IsNullOrWhiteSpace(form.quick_link_name)|| string.IsNullOrWhiteSpace(form.quick_link_address))
            {
                return 0;
            }
            _systemCenterDbSoaContext.QuickLinkListPo.Add(form);
            return _systemCenterDbSoaContext.SaveChanges();
        }

    

        public int QuickLinkListDelete(int id)
        {
           _systemCenterDbSoaContext.QuickLinkListPo.Remove(_systemCenterDbSoaContext.QuickLinkListPo.Find(id));
            return _systemCenterDbSoaContext.SaveChanges();
        }

     
        public List<QuickLinkListPo> SearchPage()
        {
          return  _systemCenterDbSoaContext.QuickLinkListPo.AsQueryable().ToList();
        }
    }
}
